package com.example.zcapi;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;

public class MyReceiver extends BroadcastReceiver {

    private String TAG = "MyReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        LogUtils.d(TAG,"AppApiUtils MyReceiver xxxxxxx" + intent.getAction());
        if (intent.getAction().equals("android.56iq.intent.action.setpoweronoff")) {
            // 在这里处理你的逻辑
            if (intent.hasExtra("timeon")) {
                int[] timeon = intent.getIntArrayExtra("timeon");
                Log.d("AppApiUtils MyReceiver", "获取的数值是 timeon: " + GsonUtils.toJson(timeon));
            }
            if (intent.hasExtra("timeoff")) {
                int[] timeoff = intent.getIntArrayExtra("timeoff");
                Log.d("AppApiUtils MyReceiver", "获取的数值是 timeoff: " +  GsonUtils.toJson(timeoff));
            }
            if (intent.hasExtra("enable")) {
                boolean enable = intent.getBooleanExtra("enable",false);
                Log.d("AppApiUtils MyReceiver", "获取的数值是: " + enable);
            }
        }
    }
}
